package 笔试真题;

import java.util.Arrays;

public class Huawei1 {
    public static void main(String[] args) {
        // 找出不含重复的字串
        int[] temp = new int[127]; // 记录上一次字串的位置
        String s = "dasdfhfjgl;'dddabcdad";
        Arrays.fill(temp, -1);
        int len = s.length();
        int maxLen = -1 << 30;
        String ans = "";
        int start = -1;
        for (int i = 0; i < len; i++) {
            start = Math.max(temp[s.charAt(i)], start);
            if (maxLen < i - start ) {
                ans = s.substring(start+1, i+1);
                maxLen = i - start ;
            }
            temp[s.charAt(i)] = i;
        }
        System.out.println(ans);
    }
}
